package com.aggregate.pay.ebcpay;

import javax.servlet.http.HttpServletRequest;

import com.aggregate.pay.ebcpay.bean.NotifyData;
import com.aggregate.pay.ebcpay.bean.QueryBalanceData;
import com.aggregate.pay.ebcpay.bean.QueryBalanceResult;
import com.aggregate.pay.ebcpay.bean.QueryPayData;
import com.aggregate.pay.ebcpay.bean.QueryPayResult;
import com.aggregate.pay.ebcpay.bean.SinglePayData;
import com.aggregate.pay.ebcpay.bean.SinglePayResult;
import com.aggregate.pay.ebcpay.support.Client;
import com.aggregate.pay.ebcpay.support.Config;
import com.aggregate.pay.ebcpay.support.Factory;
import com.aggregate.pay.ebcpay.support.HttpClient;
import com.aggregate.pay.ebcpay.support.Merch;
import com.aggregate.pay.ebcpay.support.client.NotifyPay;
import com.aggregate.pay.ebcpay.support.client.QueryBalance;
import com.aggregate.pay.ebcpay.support.client.QueryPay;
import com.aggregate.pay.ebcpay.support.client.SinglePay;

/**
 * 银盈通代付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2019年3月15日
 */
public abstract class EbcpayApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}

	@SuppressWarnings("unchecked")
	public static Client<SinglePayData, SinglePayResult> singlePayClient(Merch merch) {
		return (Client<SinglePayData, SinglePayResult>)Factory.getClient(SinglePay.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<QueryPayData, QueryPayResult> queryPayClient(Merch merch) {
		return (Client<QueryPayData, QueryPayResult>)Factory.getClient(QueryPay.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<QueryBalanceData, QueryBalanceResult> queryBalanceClient(Merch merch) {
		return (Client<QueryBalanceData, QueryBalanceResult>)Factory.getClient(QueryBalance.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<HttpServletRequest, NotifyData> notifyPayClient(Merch merch) {
		return (Client<HttpServletRequest, NotifyData>)Factory.getClient(NotifyPay.class, merch);
	}

}
